hex keypad revisited

saturday, 16 january 2021

it has just been a couple days since completing a facelift to the Number Layer to facilitate upper and lower case hexadecimal and Square, Round and Curly Bracket input. Fixing the rolling modifier key issues led to further examination of the hex keypad, the brackets and the Vim “goto” G in particular.

The hexadecimal F falls under the home row index finger as the most (likely) common hexadecimal character. The bottom row ordering for the brackets and G is less obvious. And the Vim “goto” G raised questions as a very specialized workflow delimiter for a limited audience.

On sober second thought, for list creation, a Space character is likely for most, more useful than a dedicated G key. So the obvious solution then is to provide both means.. Ha! But why stop there? What about the common hexadecimal 0x prefix!..

postfix

lists of numbers are separated by a non-blank delimiter, typically a Comma. The 0x is a very special construction. And the Vim “goto” is an integer value postfixed with the upper case G. These rules can thus be applied to the Delim key to determine its context value..

#define KEY_DOWN (record->event.pressed) #define LT_TAB LT(_NUMBER, KC_TAB) static uint16_t postfix = KC_SPC; static bool numerating = 0; static bool smart = 1; static bool leadercap = 0; bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (numerating) { switch (keycode && smart) { case KC_0: leadercap = KEY_DOWN ? 1 : 0; // if down DELIM issues 0x case KC_1: case KC_2: case KC_3: case KC_4: case KC_5: case KC_6: case KC_7: case KC_8: case KC_9: postfix = KC_G; // preceding digit for Vim goto break; case GOTO: break; default: postfix = KC_SPC; } } else { postfix = KC_SPC; } ... switch (keycode) { case LT_TAB: numerating = KEY_DOWN ? 1 : 0; // hexpad raised ... #define POSTCASE (postfix == KC_G ? UPPER : LOWER) case DELIM: if (leadercap) { mod_roll(record, 0, 0, LOWER, KC_X, 3); } // 0x else { mod_roll(record, 0, 0, POSTCASE, postfix, 3); } // smart vim goto break; ... case SMART: if (KEY_DOWN) { smart = !smart; } // smart off only issue spaces break; ...

Thus, the Vim “goto” only occurs when the last key is a digit, otherwise, it is a Space, and the 0x is inserted when the 0 is held down while the Delim is tapped, conveniently reducing the need to switch layers. If the Smart feature is turned off, the Delim always issues a Space.

ordering

the Delim key has been moved to the bottom row index finger by virtue of expected frequency of use. This changes the brackets placement from the prior ring index finger positions, to an inward finger roll, mapping to the Lessor and Greater Than sign positions of the Symbol Layer—a happy coincidence..

Corne BEAKL Wi Numbers Fnkeys Goto

Tap key actions for..

keycode single tap double tap
Dot   Colon
Comma   Semicolon
Delim Postfix Space or G or 0x**  
Smart Toggle smart Delim postfix  
Caps Hex lower -> UPPER case  
Brkt Square -> Round -> Curly brackets  

The smart action* of the Delim key combined with the recent Number Layer enhancements is like having your cake and eating it too. Layer switching is reduced, yet BEAKL pinkie finger avoidance is maintained. Pretty sweet.

*The Smart feature is a compile time config.h option.
**On tap Delim while 0 is held down.

»»  daily beakl

comment ?